function ScanActors()
{
	declare a uint local 2
	declare MinLevel int local 0
	declare MaxLevel uint local 0
	MinLevel:Set[${Math.Calc[${Me.Level}-5]}]
	MaxLevel:Set[${Math.Calc[${Me.Level}+3]}]
	if ${MinLevel} < 1
	{
		MinLevel:Set[1]
	}
	declare blacklisted bool local false
	EQ2:CreateCustomActorArray[byDist,50]
	while ${a:Inc} <= ${EQ2.CustomActorArraySize}
	{
		if ${blacklist.FirstKey(exists)}
		{
			do
			{
				if ${blacklist.CurrentKey} == ${CustomActor[${a}].ID}
				{
					blacklisted:Set[TRUE]
				}
			}
			while ${blacklist.NextKey(exists)}
		}
		if !${blacklisted}
		{
			if ${CustomActor[${a}].Type.Equal[Chest]} || ${CustomActor[${a}].Type.Equal[Corpse]} || ${CustomActor[${a}].Type.Equal[Resource]}
			{
				if !${FullInventory}
				{
					NextTarget:Set[${CustomActor[${a}].ID}]
					EA "Next Target" "${CustomActor[${a}].ID} : ${CustomActor[${a}].Name}"
					break
				}
			}
			elseif ${CustomActor[${a}].Type.Equal[NPC]} || ${CustomActor[${a}].Type.Equal[NamedNPC]}
			{
				if ${Actor[${CustomActor[${a}].ID}](exists)} && !${CustomActor[${a}].IsLocked} && ${Math.Calc[${Me.Y}+10]}>=${CustomActor[${a}].Y} && ${Math.Calc[${Me.Y}-10]}<=${CustomActor[${a}].Y} && !${CustomActor[${a}].InCombatMode}
				{
					if ${Actor[${CustomActor[${a}].ID}].Level} >= ${MinLevel} && ${Actor[${CustomActor[${a}].ID}].Level} <= ${MaxLevel}
					{
						NextTarget:Set[${CustomActor[${a}].ID}]
						EA "Next Target" "${CustomActor[${a}].ID} : ${CustomActor[${a}].Name}"
						break
					}
				}
			}
		}
		blacklisted:Set[FALSE]	
	}
}
function Scan()
{
	declare atype string local
	if ${VirtualState.Equal[ROAM]} && ${NextTarget} == 0 && !${Target(exists)}
	{
		call Idle
	}
	if (${VirtualState.Equal[ROAM]} || ${VirtualState.Equal[IDLE]})
	{
		while ${NextTarget} == 0
		{
			call ScanActors
		}
		Virtual "Scan"
		wait 20
	}
}